class Dog:
    age = 3
    def printage(self):
        print("age=",self.age)
    def printage2(self):
        print("age2=",self.age)

print(hasattr(Dog, 'age'))   # True
print(hasattr(Dog, 'name'))  # False
dog =Dog() 
dog.printage()

if hasattr(dog,'printage'):
    if(callable(getattr(dog,'printage'))):
        getattr(dog,'printage')()
try:
    method = getattr(dog,'printage3')
    method()
except:
    print('no callable printage3')